import string


def validate(email: str) -> bool:
    LETTERS = string.ascii_letters
    CHARS = LETTERS + string.digits + '.-_'


    if '@' not in email:
        return False
    two_parts = email.split('@')
    if len(two_parts) != 2:
        return False
    local, domain = email.split('@')

    # local
    if local.startswith('.') or local.endswith('.'):
        return False
    for local_char in local:
        if local_char not in CHARS:
            return False
    
    # domain
    if '.' not in domain:
        return False
    parts = domain.split('.')
    if any(len(elem) == 0 for elem in parts):
        return False
    for domain_char in domain[-1]:
        if domain_char not in LETTERS:
            return False
        
    return True
    



if __name__ == '__main__':
    print(validate("a@b.cd"))